package com.ddyx.service.impl;

import java.util.Map;

import javax.annotation.Resource;

import org.springframework.stereotype.Service;

import com.ddyx.entity.EventClickShare;
import com.ddyx.mapper.EventClickShareMapper;
import com.ddyx.service.EventClickShareService;
import com.ddyx.util.MyBeanUtils;
import com.ddyx.util.RequestForm;
import com.ddyx.util.ResponseForm;

import lombok.extern.slf4j.Slf4j;

@Service
@Slf4j
public class EventClickShareServiceImpl implements EventClickShareService{
	@Resource
	EventClickShareMapper ecsMapper;
	
	@Override
	public ResponseForm addShare(RequestForm param) {
		ResponseForm result = new ResponseForm();
		if(param.getData()!=null) {
			Map paramMap = (Map) param.getData();
			EventClickShare ecs = new EventClickShare();
			MyBeanUtils.populate(ecs, paramMap);
			try {
				int flag = ecsMapper.insertSelective(ecs);	
				if(flag<1) {
					result.setMessage("未能添加...");
				}
			} catch (Exception e) {
				result.setMessage("参数错误");
				result.setStatus(false);
				log.error("参数错误");
				e.printStackTrace();
			}
		}
		return result;
	}
	
}
